﻿CREATE TABLE [dbo].[ConturiValuta] (
    [CodValuta]       SMALLINT        CONSTRAINT [DF_ConturiValuta_CodValuta] DEFAULT ((0)) NOT NULL,
    [Cont]            [dbo].[TipCont] NOT NULL,
    [CodUnitate]      SMALLINT        CONSTRAINT [DF_ConturiValuta_CodUnitate] DEFAULT ((0)) NOT NULL,
    [DebitInitial]    DECIMAL (20, 2) CONSTRAINT [DF_ConturiValuta_DebitInitial] DEFAULT ((0)) NOT NULL,
    [CreditInitial]   DECIMAL (20, 2) CONSTRAINT [DF_ConturiValuta_CreditInitial] DEFAULT ((0)) NOT NULL,
    [DebitPrecedent]  DECIMAL (20, 2) CONSTRAINT [DF_ConturiValuta_DebitPrecedent] DEFAULT ((0)) NOT NULL,
    [CreditPrecedent] DECIMAL (20, 2) CONSTRAINT [DF_ConturiValuta_CreditPrecedent] DEFAULT ((0)) NOT NULL,
    [IdJurnal]        INT             CONSTRAINT [DF_ConturiValuta_IdJurnal] DEFAULT ((0)) NOT NULL,
    CONSTRAINT [PK_ConturiValuta] PRIMARY KEY CLUSTERED ([CodValuta] ASC, [Cont] ASC, [CodUnitate] ASC, [IdJurnal] ASC) WITH (FILLFACTOR = 90),
    CONSTRAINT [FK_ConturiValuta_Conturi] FOREIGN KEY ([Cont], [CodUnitate]) REFERENCES [dbo].[Conturi] ([Cont], [CodUnitate]),
    CONSTRAINT [FK_ConturiValuta_Jurnale] FOREIGN KEY ([IdJurnal]) REFERENCES [dbo].[Jurnale] ([IDJurnal]),
    CONSTRAINT [FK_ConturiValuta_Unitati] FOREIGN KEY ([CodUnitate]) REFERENCES [dbo].[Unitati] ([CodUnitate]),
    CONSTRAINT [FK_ConturiValuta_Valuta] FOREIGN KEY ([CodValuta]) REFERENCES [dbo].[Valuta] ([CodValuta])
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Creditul initial pentru contul,valuta', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ConturiValuta', @level2type = N'COLUMN', @level2name = N'CreditInitial';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Debit initial pentru Contul,Valuta', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ConturiValuta', @level2type = N'COLUMN', @level2name = N'DebitInitial';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Codul contului care va fi pastrat si in valuta', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ConturiValuta', @level2type = N'COLUMN', @level2name = N'Cont';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Codul Valutei', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'ConturiValuta', @level2type = N'COLUMN', @level2name = N'CodValuta';

